<?php
declare (strict_types = 1);

namespace app\admin\controller;
use think\facade\Cache;
use app\admin\model\RoleModel;
class Index extends Base
{
    public function index()
    {
        return $this->fetch();
    }

    public function welcome(){
    	return $this->fetch();
    }

    public function clear(){
    	Cache::clear();
    	return $this->success('清除成功',(string)url('index/welcome'));
    }

    /**
     * 获取用户菜单
     */
    public function getMenu(){
        $Menu=RoleModel::getRoleMenu($this->admin['role_id']);
        $list['homeInfo']=[
            'title'=>'首页',
            'href'=>(string)url('index/welcome'),
        ];
        $list['logoInfo']=[
            'title'=>'llcms',
            'image'=>'/admin/images/logo.png',
            'href'=>''
        ];
        $list['menuInfo']=$Menu;
        return json($list);
    }
}
